$#Abort Button
This button sets the GlobalPrinterAbortFlag variable which will be detected by the next Processmessages call in the HandlePrint method. This causes the Printer.Abort method to be called and allows closing the dialog prematurely if needed.

$#About CC Print Dialog
CC Print Dialog is provided by CIUPKC Software. Thanks for all the fish, and we apologize for the inconvenience.

$#Available Printers ComboBox
This combobox shows all available printers on the system. By making a selection here, and then pressing the Set Default Button, a new default printer is installed in Windows.

Note: If the printer is not currently available, attempting to print to it may hang your system!

$#Close Button
This button closes the dialog box. It will not function if a print process is running; press the Abort Button first if needed.

$#KContents
Main Dialog
Available Printers ComboBox
Set Default Printer Button
Print Button
Print to File Button
Orientation RadioGroup
Fonts Button
Setup Button
Print Manager Button
Close Button
Abort Button
Screen Dump Button
Print Preview Button
Help Button
HandlePrint method
HandleScreenDump method
HandlePrintPreview method
About CC Print Dialog

$#Fonts Button
This button brings up a fonts dialog. This dialog is set to show only the fonts available on the current printer. Since most printers use GDI fonts and accept graphics output, this will be the same as the screen display. In the case of some printers, however, extra fonts may be available, or fewer is the printer is not graphics-capable (See the Printer Capabilities Display.)

$#KGlobalPrinterAbortFlag

This flag is set by the Abort Button. If true, it will cause a call to Printer.Abort rather than Printer.EndDoc.

$#HandlePrint

procedure HandePrint( PrintToFile : Boolean);

This method is intended to be overridden by developers. It assume the programmer will make calls to the Printer.Canvas to print information. When done, a Printer.EndDoc is called unless the PrintToFile parameter is true, in which case a Printer.Abort is called since it is assumed no actual printing is desired.  What is printed is entirely up to the developer.

$#HandlePrintPreview method
This method is an example, and shows how to display a bitmap on a scaled representation of the page. It does not take into account a landscape printer setting or other considerations, but is provided as an example only.

$#HandleScreenDump method
This method does a screen dump by capturing the background canvas and copying it to the printer canvas. A useful enhancement would be to make the printer dialog invisible and do a delay prior to the capture.

$#Help Button
This button takes the user to the Main Dialog help item.

$#Main Dialog
The CC Printer Dialog is an easy way to control most aspects of printing in Delphi. Click on the hot spots on the diagram below for basic help on each control area of the dialog. Then use the provided jumps to go to detailed help on each control.

{bmc PDLG.SHG}

$#Orientation RadioGroup
This radiogroup sets the default printer's orientation between poPortrait (down the length of the paper) and poLandscape ( down the width of the paper.) Changes will take effect at the next call to the Print Button.

Note: This property cannot be set while printing is in progress or a GPF will occur, probably crashing Windows!

$#Print Button
This button starts a print job. It calls the Printer.BeginDoc method inside an exception handler block. It then calls HandlePrint, to allow user-defined printing capabilities. When the method ends, it checks to see of the GlobalPrinterAbortFlag variable is true, and if so calls Printer.Abort; otherwise it calls Printer.EndDoc to send the document to the selected printer. If an error occurs during the basic printing (usually during the EndDoc call) then the message will be displayed in the Printer Status Display and a reraising will allow the system's error handler to take over and deal with the error. If a retry is possible it will occur prior to the completion of EndDoc and no special handling is needed.

Note: If print manager is being used, or a custom spooler, errors will not appear here but in those applications instead. Print Manager can be accessed via the Print Manager shell button.

$#Print Manager Button
This button shells out to the Print Manager application. This is useful to check the status of print jobs in the queue and make changes. (Windows 3.1 does not allow other applications to access the Print Queue. Windows 95 does.)

$#Print Preview Button
This button calls the example method HandlePrintPreview, which basically shows the results of a screen dump on a simulated page. It is intended to be overridden by custom methods.

$#Print to File Button
This button behaves similarly to the Print Button, except that output is directed to a file. Since this is also a custom behavior, the same HandlePrint method is used except that the PrintToFile parameter is set to true.

$#KPrintToFile

This parameter of the HandlePrint event handler is used to signal that printing should be to a file rather than the printer. It is up to the custom handler to define the way this flag is implemented. In the default dialog, the screen dump is called and printed to a file.

$#Screen Dump Button
This button calls the HandleScreenDump method via some pointer switching. This method does a copy of the background bitmap and then sends it to the defaut printer.

$#Set Default Printer Button
This button sets the printer currently selected in the Available Printers Combobox as the system default printer. It will automatically rescan the Printer Display and Printer Capabilities Display areas when this is done.

Note: This button does not check to see if the printer is actually available.

$#Setup Button
This button brings up the Printer Setup common dialog. Since it is entirely a system dialog, settings will be made internally rather than having to be parsed by the program.

$#KThe Abort Button

This button aborts a running print activity. For more information see Abort Button.

$#KThe Available Printers Combobox

This combobox displays all available printers on the system. The printer selected here is used when the Set Default Button is pressed. For more information, see Available Printers Combobox.

$#KThe Close Button

This closes the dialog. For more information see Close Button.

$#KThe Current Printer Display

This display shows the name and port of the default printer. It also shows the current page size in pixels.

$#KThe Files To Be Printed ListBox

This is an optional listbox which can be used to display a queue of files to be printed, which can then be accessed via the HandlePrint method.

$#KThe Fonts Button

This button brings up the fonts dialog for the printer. For more information see Fonts Button.

$#KThe Orientation RadioGroup

This radiogroup controls the printer's orientation setting. For more information see Orientation RadioGroup.

$#KThe Print Button

This button starts a print job. It calls the HandlePrint event handler, which is written outside the dialog by the developer. For more information, see Print Button.

$#KThe Print Manager Button

This button shells out to the Print Manager. See Print Manager Button for more information.

$#KThe Print Preview Button

This button shows a sample preview of a screen dump. For more information see Print Preview Button.

$#KThe Print Screen Button

This button performs a Print Screen. For more information see Screen Dump Button.

$#KThe Print To File Button

This button prints to a file rather than to the printer. For more information, see Print to File Button.

$#KThe Printer Capabilities Display

This display shows the capabilities of the default printer:

Graphics Capable means the printer can display graphics. Line Printer means it cannot.
Color Capable means the printer can display color. Monochrome means it cannot.
Resolution is the current dots per inch setting of the printer. If more than one resolution is available, it can be set via the Setup Button.

$#KThe Printer Status Display

This display shows the current status of the printer. If nothing is being printed it shows Idle. If printing is in progress, it shows Printing... If an error occurs it will show the name of the error in red. If an abort has been signalled it shows Aborting...

$#KThe Set Default Printer Button

This button sets the default printer on the system to the selection in the Available Printers Combobox. For more information, see Set Default Printer Button.

$#KThe Setup Button

This button brings up the Printer Setup dialog box. For more information see Setup Button.